package com.example.com.daervideo;

import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import com.example.com.daervideo.fragments.TabContentFragment;

/**
 * Created by i7-1 on 2018/12/4.
 */

public class TestFragment extends Fragment {

    private String key;

    public static Fragment newInstance(String s) {
        TestFragment tabContentFragment = new TestFragment();
        Bundle bundle = new Bundle();
        bundle.putString("key", s);
        tabContentFragment.setArguments(bundle);
        return tabContentFragment;
    }

    @Nullable
    @Override
    public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        key = getArguments().getString("key");
        View inflate = inflater.inflate(R.layout.test, container, false);
        ((TextView) inflate).setText(key);
        return inflate;
    }

    @Override
    public void setUserVisibleHint(boolean isVisibleToUser) {
        super.setUserVisibleHint(isVisibleToUser);
        Log.e("fragment", key+" , isVisibleToUser="+isVisibleToUser);

    }
}
